#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=110;
typedef long long LL;
typedef pair<LL,LL>P;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
char ma[maxn][maxn];
char s[maxn]={"#0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"};
LL ave[maxn];
int main(void)
{
  	cin.tie(0);std::ios::sync_with_stdio(false);
    LL t;cin>>t;
    while(t--){
        memset(ave,0,sizeof(ave));
        LL n,m,k;cin>>n>>m>>k;
        LL sum=0;
        for(LL i=1;i<=n;i++){
            for(LL j=1;j<=m;j++){
                cin>>ma[i][j];
                if(ma[i][j]=='R') sum++;
            }
        }
        LL cnt=sum/k;
        LL mod=sum%k;
        for(LL i=1;i<=mod;i++){
            ave[i]++;
        }
        for(LL i=1;i<=k;i++){
            ave[i]+=cnt;
        }
        LL have=0;LL tot=1;
        for(LL i=1;i<=n;i++){
            if(i&1){
                for(LL j=1;j<=m;j++){
                    if(ma[i][j]=='R'){
                        have++;
                    }
                    if(have!=ave[tot]){
                        ma[i][j]=s[tot];
                    }
                    else{
                        ma[i][j]=s[tot];
                        have=0;
                        if(tot!=k) tot++;
                    }
                }
            }
            else{
                for(LL j=m;j>=1;j--){
                    if(ma[i][j]=='R'){
                        have++;
                    }
                    if(have!=ave[tot]){
                        ma[i][j]=s[tot];
                    }
                    else{
                        ma[i][j]=s[tot];
                        have=0;
                        if(tot!=k) tot++;
                    }
                }
            }
        }
        for(LL i=1;i<=n;i++){
            for(LL j=1;j<=m;j++){
                cout<<ma[i][j];
            }
            cout<<"\n";
        }
    }
return 0;
}
